<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            width: 200px;
            height: 200px;
            margin: auto;
            border: 1px solid red;
            font-size: 40px;
            text-align: center;
            line-height: 200px;
            color: orange;
        }
        input{
            margin-top: 50px;
        }
        #btn1{
            margin-left: 680px;
        }
    </style>
</head>
<body>
    <div id="box">10</div>
    <input type="button" id="btn1" value="开始">
    <input type="button" id="btn2" value="暂停">
    <input type="button" id="btn3" value="重置">
    <img src="./l0.jpg" id="img" alt="">
    <script>
        //     倒计时
        // - 三个按钮，先实现基本功能，不用控制按钮的禁用
        var box = document.querySelector("#box");
        var btn1 = document.querySelector("#btn1");
        var btn2 = document.querySelector("#btn2");
        var btn3 = document.querySelector("#btn3");

        var t;
        btn1.onclick = function(){
            clearInterval(t);
            t = setInterval(function(){
                var text = box.innerHTML;
                box.innerHTML = text - 1 < 0 ? 0 : text - 1;
            },1000)

            btn1.disabled = true;
            btn2.disabled = false;
            btn3.disabled = true;
        }

        btn2.onclick = function(){
            clearInterval( t );
            btn1.disabled = false;
            btn2.disabled = true;
            btn3.disabled = false;
        }

        btn3.onclick = function(){
            clearInterval( t );
            box.innerHTML = 10;
            btn1.disabled = false;
            btn2.disabled = true;
            btn3.disabled = true;
        }

        // 3. 回到顶部
        document.onclick = function(){
            document.documentElement.scrollTop = 0;
        }
    </script>
</body>
</html>